original works, reproduced please indicate: http://blog.csdn.net/Xiejingfa/article/details/50550416
In the previous article, "Redis Note (ii)" In the Redis data structure-string string, we learned about Redis's most basic data structure, string, and today our protagonist is the –hash (hash) type. description of
hashing type (hash) related Operations
We can consider the hashes type in Redis as a map container with string key and string value. Therefore, this type is ideal for storing information about value objects.such as username, password, and age. If a hash contains very few fields, the data of that type will take up only a small amount of disk space. Each
SummaryThe previous article described the installation of the Redis client and server side, as well as a general introduction to Redis. This article focuses on explaining. NET4.0 and. How to manipulate a hash table using Redis and C # Redis in NET4.5. And some code from the
First, overview:
The hash type in Redis is considered to be a map container with Stringkey and string value. So the type is ideal for storing information about a value object. such as username, password and age. If the hash contains few fields, the data of that type will take up only a small amount of disk space. Each hash
I. Concept
In Redis, there is also a hash type for the structure of key-value pairs like other languages, and the key value of a redis hash type is itself a key-value pair structure.
Such as:
Key
value
User:1
Key
value
Code
01
Name
Shl
Use
Redis Hash is a string-type field and value mapping table, and hash is particularly useful for storing objects.
Each hash in a Redis can store 2^32-1 key-value pairs (more than 4 billion).
Example
127.0.0.1:6379> hmset runoobkey name "
Php methods and code examples for operating hash and zset data in redis. In the previous blog, the main types are string, list, and set. hash and zset type 1 are listed below. hset description: set the field value in the hash table key to value. If the key does not exist, the previous blog mainly belongs to the string,
is returned.
10, hincrby
Description: adds an incremental increment to the field value of the hash table key. An increment can also be a negative number, which is equivalent to performing a subtraction operation on a given domain.Parameter: key field incrementReturned value: the field value in the key of the hash table after the HINCRBY command is executed.
11, hkeys
Description: return all fields in the
hashing (hash)The Hash type in Redis can be seen as a map container with string key and string value. This type is ideal for storing object information. such as the user's username password and so on. Each Hash can store 4,294,967,295 key-value pairs
Storage (Hset)
Hset key field Value field does not exist and is stor
Redis Hash is a string-type field and value mapping table. Its addition, delete operations are O (1) (average). Hash is particularly useful for storing objects. there is a single string type compared to each field of an object. Storing an object in a hash type takes up less memory and makes it easier to access the enti
This article mainly introduces php methods and code examples for operating hash and zset data in redis. This article describes 26 groups of functions or methods, for more information, see the previous blog: string, list, and set. The following are hash and zset types.
1, hset
Description: sets the field value in the key field of the
The hash table is also one of the data structures supported by Redis, which uses both redis_encoding_ziplist (compressed list) and redis_encoding_ht (data Dictionary) encoding methods.When a hash table uses a compressed list, it uses the following structure to store the data (see ZIPLIST.C):+---------+------+------+------+------+------+------+------+------+------
hdel key field [field ...]
Deletes one or more specified domains in the hash table key, and the nonexistent fields are ignored.In versions below Redis2.4, Hdel can delete only a single domain at a time, and if you need to delete multiple domains in an atomic time, include the command in the Multi/exec block.Available versions:2.0.0+Complexity of Time:O (n), n is the number of fields to be deleted.return value:The number of domains successfully remove
Description: Adds increment increment to the value of the field field in the hash table key. An increment can also be a negative number, which is equivalent to subtracting a given field.Parameters: Key field incrementReturn value: The value of the field field in the hash table key after executing the Hincrby command.
11,hkeys
Description: Returns all the fields in the
Tags: redis--hashRedis Hash is a string-type field and value mapping table, and hash is particularly useful for storing objects.1, Hset Method:Hset key field valueSet the value of the field (field) fields in the hash table key to value.If the key does not exist, a new hash t
During cluster deployment, for high availability purposes, sessions are often shared and shared into two categories: Session replication and centralized management.Redis can play a more important role in the centralized management of the session.Two main factors restricting the session centralized sharing:1. The session must have an HA mechanism to ensure that the session is not lost in the event of a failure of some servers in the cluster.2. Session life cycle Management.3. The session size is
Redis Hash Key command Implementation (T_hash)
1. Hash command Introduction
All Redis hash commands are shown in the following table: Redis hash command in detail
Serial N
This article mainly introduces php methods and code examples for operating hash and zset data in redis. This article describes 26 groups of functions or methods. For more information, see
This article mainly introduces php methods and code examples for operating hash and zset data in redis. This article describes 26 gr
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.